package cn.xfdzx.android.apps.shop.activity.ruzhu;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;

import butterknife.BindView;
import butterknife.OnClick;
import cn.xfdzx.android.apps.shop.R;
import cn.xfdzx.android.apps.shop.activity.MainActivity;
import cn.xfdzx.android.apps.shop.base.BaseMvpActivity;
import cn.xfdzx.android.apps.shop.bean.GetJieguoBeen;
import cn.xfdzx.android.apps.shop.contract.ExaminContract;
import cn.xfdzx.android.apps.shop.presenter.ExminPresenter;

public class QianYueActivity extends BaseMvpActivity<ExminPresenter> implements ExaminContract.View {


    @BindView(R.id.ll_state)
    LinearLayout llState;
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.rl_title)
    RelativeLayout rlTitle;
    @BindView(R.id.tv_title_name)
    TextView tvTitleName;
    @BindView(R.id.image)
    ImageView image;
    @BindView(R.id.tishi)
    TextView tishi;
    @BindView(R.id.rl_shop_photo)
    RelativeLayout rlShopPhoto;
    @BindView(R.id.tv_yi_du)
    TextView tvYiDu;
    @BindView(R.id.text)
    TextView text;

    @Override
    public int getLayoutId() {
        return R.layout.activity_qian_yue;
    }

    @Override
    public void initView() {
        Intent intent = getIntent();
        String url = intent.getStringExtra("url");
        String state = intent.getStringExtra("state");
        if (state.equals("SIGNED")){
            tvTitle.setText("扫码");
        }else{
            tvTitle.setText("扫码");
        }
        RoundedCorners roundedCorners = new RoundedCorners(10);
        //通过RequestOptions扩展功能,override:采样率,因为ImageView就这么大,可以压缩图片,降低内存消耗
        RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
        Glide.with(getApplication()).load(url).apply(options.transform(new CenterCrop(), roundedCorners)).into(image);

    }

    @Override
    public void onJieGuo(GetJieguoBeen been) {

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void onError(Throwable throwable) {

    }

    @OnClick({R.id.iv_back, R.id.image, R.id.tv_yi_du})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.image:
                break;
            case R.id.tv_yi_du:
                finish();
                break;
        }
    }
}